﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using CNLTHD_GoogleMapAPI_DAO;
using CNLTHD_GoogleMapAPI_DTO;
using CNLTHD_GoogleMapAPI.UserControl;
using System.Web.UI.WebControls;

namespace CNLTHD_GoogleMapAPI
{
    public partial class ThemDiaDiem : System.Web.UI.Page
    {
        public bool dangNhap = false;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["NguoiDung"] != null)
                dangNhap = true;
         
            if (!IsPostBack)
            {
				kinhDo.Text = Request.QueryString["KinhDo"];
				viDo.Text = Request.QueryString["ViDo"];
                List<LoaiDiaDiem> list = LoaiDiaDiemDAO.LayDaySachLoaiDiaDiem();
                loaiDD.DataSource = list;
                loaiDD.DataTextField = "TenLoaiDiaDiem";
                loaiDD.DataValueField = "MaLoaiDiaDiem";
                loaiDD.DataBind();
            }
        }

        protected void bnt_Onclick(object sender, EventArgs e)
        {
            Double DkinhDo = Double.Parse(kinhDo.Text);
            Double DviDo = Double.Parse(viDo.Text);
            String StenDD = tenDD.Text;
            NguoiDung nd = (NguoiDung)Session["NguoiDung"];
            DiaDiemDAO.ThemDiaDiem(DkinhDo, DviDo, nd.MaNguoiDung, Int32.Parse(loaiDD.SelectedValue), StenDD, ghiChu.Text);
            this.Response.Redirect("ThemThanhCong.aspx");
        }
    }
}